﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#include "ByCategoryOrSetMaterialDialog.h"
#include <qpushbutton.h>
#include "GbmpNew.h"
#include "TranslatorManager.h"
#include "EnableCompileWarning_The_LAST_IncludeInCpp.h"

ByCategoryOrSetMaterialDialog::ByCategoryOrSetMaterialDialog()
    : m_isToByCategory(false)
    , m_isToSetMaterial(false)
{
    setWindowTitle(QString::fromStdWString(GBMP_TR(L"设置材质")));
    setObjectName(QString::fromStdWString(L"ByCategoryOrSetMaterialDialog"));
      
    int btnWidth = 80;
    int btnHeight = 30;
    int btnGapHori = 20;
    int btnGapVert = 10;

    int dlgWidth = btnWidth * 2 + btnGapHori * 3;
    int dlgHeight = btnHeight + btnGapVert * 2;

    this->setFixedSize(dlgWidth, dlgHeight);

    QPushButton *byCategoryBtn = NEW_AS_QT_CHILD(QPushButton, this);
    byCategoryBtn->setObjectName(QString::fromStdWString(L"byCategoryBtn"));
    byCategoryBtn->setText(QString::fromStdWString(GBMP_TR(L"按类别")));
    byCategoryBtn->setGeometry(QRect(btnGapHori, btnGapVert, btnWidth, btnHeight));
    QObject::connect(byCategoryBtn, SIGNAL(clicked()), this, SLOT(ByCategoryBtnClicked()));

    QPushButton *settingMaterialBtn = NEW_AS_QT_CHILD(QPushButton, this);
    settingMaterialBtn->setObjectName(QString::fromStdWString(L"settingMaterialBtn"));
    settingMaterialBtn->setText(QString::fromStdWString(GBMP_TR(L"设置材质")));
    settingMaterialBtn->setGeometry(QRect(btnGapHori * 2 + btnWidth, btnGapVert, btnWidth, btnHeight));
    QObject::connect(settingMaterialBtn, SIGNAL(clicked()), this, SLOT(SettingMaterialBtnClicked()));
}

void ByCategoryOrSetMaterialDialog::ByCategoryBtnClicked()
{
    m_isToByCategory = true;
    QDialog::accept();
}

void ByCategoryOrSetMaterialDialog::SettingMaterialBtnClicked()
{
    m_isToSetMaterial = true;
    QDialog::accept();
}

